package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Scanner;

public class HWBJ73 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int[] cakes = Arrays.stream(scanner.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();

        int[] gifts = Arrays.stream(scanner.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();

        int max = Integer.parseInt(scanner.nextLine());

        int a = 0;
        for (int cake : cakes) {
            for (int gift : gifts) {
                if (cake + gift <= max) {
                    a++;
                } ;
            }
        }
        System.out.println(a);

    }
}
